#include "../../source/Server.hpp"

int main()
{
    Socket client;
    client.CreateClient(8888, "127.0.0.1");

    try {
        for (int i = 0; i<5; ++i)
        {
            std::string  str = "Client: hello world";

            client.Send(str.c_str(), str.size());

            char buf[1024] = { 0 };
            ssize_t ret = client.Recv(buf, 1023);
            if (ret < 0)
            {
                // LOG(DEBUG, "接收失败");
                std::cout << "接收失败" << std::endl;
            }
            std::cout << buf << std::endl;
        }

        std::cout << "Send ending---------" << std::endl;
        while (1)
        {
            sleep(1);
        }
    } catch (std::exception& e) {
        std::cerr << e.what() << std::endl;
    }
    
    
    
    return 0;
}